function EmptyOnClick(id, text)
{
	var el = document.getElementById(id);
	if(el.value == text){
		el.value = "";
	}
}
$(document).ready(function() {
	$("#login-username").blur(function(){
	    if($("#login-username").val() == ""){
	    	$("#login-username").val("Username");
	    }	
	}); 
	$("#login-password").blur(function(){
	    if($("#login-password").val() == ""){
	    	$("#login-password").val("xxxxxx");
	    }	
	});
	$("#login-password").focus(function(){
	    if($("#login-password").val() == "xxxxxx"){
	    	$("#login-password").val("");
	    }
	});
});
function slideChange(slider){
	//alert (slider.slider('value'));
}

$(document).ready(function() {
	$("#step1 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slide", function(event, ui) {
			$(this).children("a").attr('title', ui.value/10);
			var offset1 = $(this).children('.ui-slider-handle').first().offset();
			var offset2 = $(this).children('.ui-slider-handle').last().offset();
			if(ui.value == 0){
				$(".slidertooltip-content").html("completely dissatisfied");
			}else if(ui.value == 10 || ui.value == 20){
				$(".slidertooltip-content").html("very dissatisfied");
			}else if(ui.value == 30 || ui.value == 40){
				$(".slidertooltip-content").html("somewhat satisfied");
			}else if(ui.value == 50){
				$(".slidertooltip-content").html("satisfied");
			}else if(ui.value == 60 || ui.value == 70){
				$(".slidertooltip-content").html("well satisfied");
			}else if(ui.value == 80 || ui.value == 90){
				$(".slidertooltip-content").html("very satisfied");
			}else if(ui.value == 100){
				$(".slidertooltip-content").html("completely satisfied");
			}
			$(".slidertooltip-step1").css('top',offset1.top - 5).css('left',offset1.left +15).show();
		});
	});
	$("#step1 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slidestop", function(event, ui) {
			$(".slidertooltip-step1").hide();
		});
	});
	$("#step2 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slide", function(event, ui) {
			$(this).children("a").attr('title', ui.value/10);
			var offset1 = $(this).children('.ui-slider-handle').first().offset();
			var offset2 = $(this).children('.ui-slider-handle').last().offset();
			if(ui.value == 0){
				$(".slidertooltip-content").html("not important");
			}else if(ui.value == 10 || ui.value == 20){
				$(".slidertooltip-content").html("not very important");
			}else if(ui.value == 30 || ui.value == 40){
				$(".slidertooltip-content").html("somewhat important");
			}else if(ui.value == 50){
				$(".slidertooltip-content").html("important");
			}else if(ui.value == 60 || ui.value == 70){
				$(".slidertooltip-content").html("very important");
			}else if(ui.value == 80 || ui.value == 90){
				$(".slidertooltip-content").html("extremely important");
			}else if(ui.value == 100){
				$(".slidertooltip-content").html("imperative");
			}
			$(".slidertooltip-step1").css('top',offset1.top - 5).css('left',offset1.left +15).show();
		});
	});
	$("#step2 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slidestop", function(event, ui) {
			$(".slidertooltip-step1").hide();
		});
	});
	
	$("#step3 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slide", function(event, ui) {
			$(this).children("a").attr('title', ui.value/10);
			var offset1 = $(this).children('.ui-slider-handle').first().offset();
			var offset2 = $(this).children('.ui-slider-handle').last().offset();
			if(ui.value == 0){
				$(".slidertooltip-content").html("completely dissatisfied");
			}else if(ui.value == 10 || ui.value == 20){
				$(".slidertooltip-content").html("very dissatisfied");
			}else if(ui.value == 30 || ui.value == 40){
				$(".slidertooltip-content").html("somewhat satisfied");
			}else if(ui.value == 50){
				$(".slidertooltip-content").html("satisfied");
			}else if(ui.value == 60 || ui.value == 70){
				$(".slidertooltip-content").html("well satisfied");
			}else if(ui.value == 80 || ui.value == 90){
				$(".slidertooltip-content").html("very satisfied");
			}else if(ui.value == 100){
				$(".slidertooltip-content").html("completely satisfied");
			}
			$(".slidertooltip-step1").css('top',offset1.top - 5).css('left',offset1.left +15).show();
		});
	});
	$("#step3 div.slider-wrapper > div").each(function(index) {
		$(this).bind( "slidestop", function(event, ui) {
			$(".slidertooltip-step1").hide();
		});
	});
});

function changeValue() {
	$("#trust-score").val($( "#trust-slider" ).slider( "value" ));
	$("#respect-score").val($("#respect-slider" ).slider( "value" ));
	$("#care-score").val($("#care-slider" ).slider( "value" ));
	$("#commitment-score").val($("#commitment-slider" ).slider( "value" ));
	$("#financial-score").val($("#financial-slider" ).slider( "value" ));
	$("#domestric-score").val($("#domestric-slider" ).slider( "value" ));
	$("#intimacy-score").val($("#intimacy-slider" ).slider( "value" ));
	$("#physical-score").val($("#physical-slider" ).slider( "value" ));
	$("#fun-time-score").val($("#fun-time-slider" ).slider( "value" ));
	$("#best-friend-score").val($( "#best-friend-slider" ).slider( "value" ));
	$("#spiritual-intimacy-score").val($( "#spiritual-intimacy-slider" ).slider( "value" ));
	$("#conflict-resolution-score").val($( "#conflict-resolution-slider" ).slider( "value" ));
}
function checkStep(text){
	var numberOfStep = 0;
	$("div.count-step > input").each(function(){
		//alert($(this).val());
		if($(this).val() == "1"){
			numberOfStep ++;
		}
	})
	if(numberOfStep < 12){
		alert(text);
		return false;
	}else{
		return true;
	}
}
function checkfinish(){
	var numberOfStep = 0;
	$("div.count-step > input").each(function(){
		if($(this).val() == "1"){
			numberOfStep ++;
		}
	})
	if(numberOfStep < 12){
		return false;
	}else{
		$(".indicator-label-item > a").removeClass("indicator-marked");
		$("div#introduction").html("");
		$("#selecting-step").val("");
		return true;
	}
}